#include "comm.hpp"

int main()
{
    Init mk;   //创建管道

    int fd=open(PATH,O_RDONLY); 
    if(fd==-1)
    {
        perror("server open");
        exit(-1);
    }
    char buff[SIZE];
    while(true)
    {
        ssize_t n=read(fd,buff,sizeof(buff));
       // ssize_t n=read(fd,buff,sizeof(buff)-1);
        if(n>0)
        {
            printf("n = %d\n", n);
            buff[n] = '\0';
            //cout<<"client say : "<<buff;
            printf("client say : %s\n",buff);
            fflush(stdout);
            memset(buff,'\0',sizeof(buff));     
        }
        else
        {
            exit(-1);
        }
    }
    
    close(fd);

    return 0;
}
